package com.example.controller.redis;

import com.example.annotation.redis.AccessLimit;
import com.example.annotation.redis.SubmitLock;
import com.example.util.redis.RedisUtil;
import com.example.pojo.vo.redis.TestRequestVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/21 16:37
 */
@RestController
public class TestController {

    @Autowired
    RedisUtil redisUtil;

    /**
     * 表单提交限制
     * @return
     */
    @RequestMapping(value = "testLock")
    @SubmitLock
    public Object testLock(){
        System.out.println("yes");
        return "yes";
    }

    @RequestMapping(value = "testLock2")
    @SubmitLock
    public Object testLock2(MultipartFile file,String key,String value,TestRequestVo requestVo){

        System.out.println("yes"+file.getOriginalFilename());
        return "yes";
    }

    /**
     *接口防刷测试
     * http://localhost:8082/testSearch 提交10次
     * @return
     */
    @RequestMapping(value = "testSearch")
    @AccessLimit()
    public Object testSearch(){
        System.out.println("yes");
        return "ok";
    }


}
